-
Notifications
You must be signed in to change notification settings - Fork 329
Add enum and number values support to JsonKeysetCursorStrategy #1346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add enum and number values support to JsonKeysetCursorStrategy #1346
Conversation
Signed-off-by: Ilya Bakaev <stupid58fly@gmail.com>
|
Hello @stupid58fly We're considering both this issue and #1347. Could you first elaborate a bit on the exact problem you're seeing? How do your entities/repositories/data fetchers look like in your code and what error are you hitting exactly? We don't need a complete analysis of the problem, but rather a short sample or anything that can help us better understand the use case would be welcome. |
i have @Entity
@Table(name = "product")
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private BigDecimal cost;
}public interface ProductRepository extends JpaRepository<Product, Long> {
Window<Product> findByIdIsNotNull(ScrollPosition position, Sort sort, Limit limit);
}@Controller
@RequiredArgsConstructor
public class ProductController {
private final ProductRepository productRepository;
@QueryMapping
public Window<Product> products(ScrollSubrange scrollSubrange) {
var position = scrollSubrange.position().orElseGet(ScrollPosition::keyset);
var sort = Sort.by(Sort.Direction.ASC, "cost");
var limit = scrollSubrange.count().stream().boxed().findFirst().map(Limit::of).orElseGet(Limit::unlimited);
return productRepository.findByIdIsNotNull(position, sort, limit);
}
}when i try to fetch products without parameters, all is ok query MyQuery {
products (
after: "S19bImphdmEudXRpbC5Db2xsZWN0aW9ucyRVbm1vZGlmaWFibGVNYXAiLHsiaWQiOlsiamF2YS5sYW5nLkxvbmciLDIwXSwiY29zdCI6WyJqYXZhLm1hdGguQmlnRGVjaW1hbCIsMC4wMF19XQ=="
first: 10
) {
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
edges {
cursor
node {
cost
id
name
}
}
}
}and this PR will fix the issue with deserialization for number (long, big decimal, etc) and enums the issue #1347 is aimed for a more general fix, i.e. for |
same issue as at #1327 for enum and numeric values exept integer and double